package com.wosiliujing.learning.config;

import com.wosiliujing.learning.handler.HystrixHandler;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;

/**
 * @author liujing
 */
@Slf4j
@AllArgsConstructor
@Configuration
public class RouterConfig {

    private final HystrixHandler hystrixHandler;

    @Bean
    public RouterFunction routerFunction(){
        return RouterFunctions.route(RequestPredicates.path("/fallback"),hystrixHandler);
    }

}
